export default class bullet extends Laya.Script {
    // 更多参数说明请访问: https://ldc2.layabox.com/doc/?nav=zh-as-2-4-0
    rig=null;
    owner=this.owner as Laya.Sprite;
    constructor() { super(); }
    onAwake(){
        this.rig=this.owner.getComponent(Laya.RigidBody)
        this.rig.linearVelocity={x:this.getRandom(-20,20),y:this.getRandom(-20,20)}
    }
    getRandom(min,max){
        var value=Math.random()*(max-min);
        value=Math.round(value);
        return min+value;
        }
    onTriggerEnter(other){
            if(other.label=="AI"){
                this.owner.removeSelf();
            }
        }
        onTriggerExit(other){
            if(other.label=="Top"){
                this.owner.removeSelf();
            }
        }

        
}